package com.project.myshop.web.controller;

import com.project.myshop.entity.User;
import com.project.myshop.services.UserServices;
import com.project.myshop.services.impl.UserServicesImpl;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/user")
public class UserController extends BaseServlet{
    private UserServices us=new UserServicesImpl();
    public String checkName(HttpServletRequest request, HttpServletResponse response){
        //接收用户提交的数据
        String username = request.getParameter("username");
        //访问业务层
        User user=us.findUserByName(username);
        //根据不同结果给出不同的响应
        if (user!= null) {
            return "1";

        }else {
            return "0";
        }

    }
}
